<?php

namespace app\screen\controller;

use app\common\lib\Show;
use think\response\Json;

class Chart extends ScreenBase
{
    /**
     * 获取最高学历柱图
     * @return Json
     */
    public function highEducationBar(): Json
    {
        try {
            $result=(new \app\common\business\Chart())->highEducationBar();
        }catch (\Exception $e){
            return Show::error([], $e->getMessage(), $e->getCode());
        }
        return Show::success($result);
    }

    /**
     * 性别占比饼图
     * @return Json
     */
    public function genderPie(): Json
    {
        try {
            $result=(new \app\common\business\Chart())->genderPie();
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }

    /**
     * 人才指标 各种人才数
     * @return Json
     */
    public function indicatorsNumberPie(): Json
    {
        try {
            $result=(new \app\common\business\Chart())->indicatorsNumberPie();
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }



    /**
     * 获取政治面貌饼图
     * @return Json
     */
    public function politicsPie(): Json
    {
        try {
            $result=(new \app\common\business\Chart())->politicsPie();
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }

    /**
     * 获取单位性质 柱图
     * @return Json
     */
    public function unitNatureBar(): Json
    {
        try {
            $result=(new \app\common\business\Chart())->unitNatureBar();
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }

    /**
     * 获取职称等级统计
     * @return Json
     */
    public function titlesLevelBar(): Json
    {
        try {
            $result=(new \app\common\business\Chart())->titlesLevelBar();
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }




    /**
     * 获取各县市项目扶持资金
     * @return Json
     */
    public function projectMoneyBar(): Json
    {
        try {
            $result=(new \app\common\business\Chart())->projectMoneyBar();
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }

    /**
     * 获取科研机构类别对应机构数量TOP4
     * @return Json
     */
    public function institutionList(): Json
    {
        try {
            $result=(new \app\common\business\Chart())->institutionList();
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }



    /**
     * 获取各县市引进人才数
     * @return Json
     */
    public function introductionTalent(): Json
    {
        try {
            $result=(new \app\common\business\Chart())->introductionTalent();
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }

    /**
     * 获取人才年龄占比
     * @return Json
     */
    public function agePie(): Json
    {
        try {
            $result=(new \app\common\business\Chart())->agePie();
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }

    /**
     * 获取学历占比
     * @return Json
     */
    public function educationTower(): Json
    {
        try {
            $result=(new \app\common\business\Chart())->educationTower();
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }

    /*----------------*/
    /**
     * 获取各县市人才投入指标
     * @return Json
     */
    public function indicatorsList(): Json
    {
        try {
            $result=(new \app\common\business\Chart())->indicatorsList();
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }

    /**
     * 获取人才云图页面顶部统计数
     * @return Json
     */
    public function totalCount1(): Json
    {
        try {
            $result=(new \app\common\business\Chart())->totalCount1();
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }

    /**
     * 重点人才情况
     * @return Json
     */
    public function keyTalents(): Json
    {
        try {
            $result=(new \app\common\business\Chart())->keyTalents();
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }

    /**
     * 高层次平台建设
     * @return Json
     */
    public function scientificCategoryCount(): Json
    {
        try {
            $result=(new \app\common\business\Chart())->scientificCategoryCount();
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }

    /**
     * 年龄分布
     * @return Json
     */
    public function ageDistribution(): Json
    {
        try {
            $result=(new \app\common\business\Chart())->ageDistribution();
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }

    /**
     * 争取资金
     * @return Json
     */
    public function fundingList(): Json
    {
        try {
            $result=(new \app\common\business\Chart())->fundingList();
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }

    /**
     * 年度省级人才项目入选情况统计表
     * @return Json
     */
    public function talentProject(): Json
    {
        $year=$this->request->get('year');
        try {
            $result=(new \app\common\business\Chart())->talentProject($year);
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }
    /**
     * 各县市项目数量、资金雷达
     * @return Json
     */
    public function projectInfoRadar(): Json
    {
        try {
            $result=(new \app\common\business\Chart())->projectInfoRadar();
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }
    /**
     * 获取各县市项目数量
     * @return Json
     */
    public function projectBar(): Json
    {
        try {
            $result=(new \app\common\business\Chart())->projectBar();
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }

    /**
     * 人才引进
     * @return Json
     */
    public function talentIntroduce(): Json
    {
        try {
            $result=(new \app\common\business\Chart())->talentIntroduce();
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }

    /**
     * 市级重点人才项目
     * @return Json
     */
    public function talentProjectChart(): Json
    {
        try {
            $result=(new \app\common\business\Chart())->talentProjectChart();
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }

    /**
     * 人才实训基地
     * @return Json
     */
    public function talentBaseChart(): Json
    {
        try {
            $result=(new \app\common\business\Chart())->talentBaseChart();
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }

    /**
     * 年度全市人才总量及投入
     * @return Json
     */
    public function talentTotal(): Json
    {
        $year=$this->request->get('year');
        try {
            $result=(new \app\common\business\Chart())->talentTotal($year);
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }

    /**
     * 重点科研机构数据
     * @return Json
     */
    public function importantScientific(): Json
    {
        try {
            $result=(new \app\common\business\Chart())->importantScientific();
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }

    /**
     * 人才技术领域
     * @return Json
     */
    public function talentTechnology(): Json
    {
        try {
            $result=(new \app\common\business\Chart())->talentTechnology();
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }

    public function enterpriseTalent(){
        try {
            $result=(new \app\common\business\Chart())->enterpriseTalent();
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }

    public function talentList(){
        $pram=$this->request->get();
        try {
            $result=(new \app\common\business\Chart())->talentList($pram);
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }

    public function scientificList(){
        $pram=$this->request->get();
        try {
            $result=(new \app\common\business\Chart())->scientificList($pram);
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }

    public function getMarkers(){
        try {
            $result=(new \app\common\business\Chart())->getMarkers();
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }

    public function areaProportion(){
        try {
            $result=(new \app\common\business\Chart())->areaProportion();
        }catch (\Exception $e){
            return Show::error([],$e->getMessage(),$e->getCode());
        }
        return Show::success($result);
    }
}
